// 导入数据库API
const db = require("../../config/db");

module.exports = {
    get_goods(goods_type) {
        // console.log("2.0", goods_rq);
        return new Promise((resolve, reject) => {
            let goods_sql = `select * from db_goods where ${goods_type}=1`;
            // console.log("3.0", goods_sql);
            db.query(goods_sql, (error, result) => {
                if (error) {
                    reject({
                        code: -1,
                        msg: "查询商品列表失败",
                        error,
                    });
                } else {
                    resolve({
                        code: 200,
                        result,
                    });
                }
            });
        });
    },
};
